package fpzhan.plane.program.manager;

import fpzhan.plane.program.util.StringUtils;
import fpzhan.plane.program.struct.CodeBlockStruct;

import java.util.HashMap;
import java.util.Map;

public class StructManager {

    private  Map<String, CodeBlockStruct> structs=new HashMap<>();

    private  String useName;

    public  void register(CodeBlockStruct struct){
        structs.put(struct.getName(),struct);
    }

    public  void use(String useName){
       this.useName=useName;
    }

    public  CodeBlockStruct getStruct(){
        if (StringUtils.isEmpty(useName))return null;
        return structs.get(useName);
    }
}
